/*
 * @Description: 全宗上下文
 * @Author: Rfan
 * @Date: 2022-01-08 16:30:05
 * @LastEditTime: 2022-02-24 14:58:58
 */

import { createContext, useContext, useReducer } from 'react';
import { EstrayRecordReducer } from '../reducers/EstrayRecordReducer';

const initialState = {};

const EstrayRecordContext = createContext();

const EstrayRecordContextProvider = (props) => {
  const [state, dispatch] = useReducer(EstrayRecordReducer, initialState);

  const actions = {
    fetchATLevel() {
      dispatch({ type: '' });
    }
  };

  return (
    <EstrayRecordContext.Provider value={{ ...state, ...actions }}>
      {props.children}
    </EstrayRecordContext.Provider>
  );
};

export const useEstrayRecordContext = () => {
  return useContext(EstrayRecordContext);
};

export { EstrayRecordContext, EstrayRecordContextProvider };
